import Cookie from 'js-cookie'

export const setCookie = function (key, value) {
  Cookie.set(key, value)
}
export const getCookie = function (key) {
  return Cookie.get(key)
}
export const getJsonCookie = function (key) {
  return Cookie.getJSON(key) || {}
}
export const clearCookie = function (key) {
  return Cookie.remove(key)
}

// 本地存储 localStorage方式
export const savelocalStorage = (key, value) => {
  localStorage.setItem(key, JSON.stringify(value))
}

// 本地获取 localStorage方式
export const getlocalStorage = (key, value) => {
  return JSON.parse(localStorage.getItem(key)) || {}
}

// 本地存储 sessionStorage方式
export const saveSessionStorage = (key, value) => {
  sessionStorage.setItem(key, JSON.stringify(value))
}

// 本地获取 sessionStorage方式
export const getSessionStorage = (key, value) => {
  return JSON.parse(sessionStorage.getItem(key)) || {}
}


